package com.persagy.iot.func

import com.persagy.iot.bean.IOTData
import com.persagy.iot.utils.HbaseUtil
import org.apache.flink.configuration.Configuration
import org.apache.flink.streaming.api.functions.sink.{RichSinkFunction, SinkFunction}
import org.apache.hadoop.hbase.TableName
import org.apache.hadoop.hbase.client.{Connection, Table}

class IOTLateSinkFunction  extends RichSinkFunction[IOTData]{

  val accuracy_tableName: String = "accuracy_data"
  val family: String = "data"
  val sysTime: String = "sys_time"
  val value: String = "value"

  var conn: Connection = _
  var table: Table = _

  override def open(parameters: Configuration): Unit = {
    println("init Hbase ......")
    conn = HbaseUtil.getHbaseConnection()

    table = conn.getTable(TableName.valueOf(accuracy_tableName))
  }

  override def invoke(value: IOTData, context: SinkFunction.Context[_]): Unit = {

  }

  override def close(): Unit = {

  }
}
